import http from "@/component/http";
import { Modal, Form, Input, Col, Button, message } from "antd";
import React from "react";

type Iprop = {
  out:boolean,
  setOut:Function
}

const Rejection: React.FC<Iprop> = (props:any) => {
  const confirm = (value: string) => {
    http
      .get("customer/certification/rejection.json", value)
      .then((res: any) => {
        if (res.resCode === "000000") {
          message.success({
            content: res.resMsg,
          });
          props.setOut(false);
        } else {
          message.success({
            content: res.resMsg || "请求失败",
          });
        }
      });
  };
  return (
    <div>
      <Modal
        title="驳回认证"
        visible={props.out}
        keyboard={false}
        maskClosable={false}
        width={300}
        onCancel={() => props.setOut(false)}
        footer=""
        className="examine"
      >
        <Form onFinish={confirm}>
          <Form.Item
            name="again"
            label="请输入驳回理由"
            rules={[{ required: true }]}
          >
            <Input placeholder="请输入" />
          </Form.Item>
          <Col className="footer">
            <Button onClick={() => props.setOut(false)}>取消</Button>
            <Button htmlType="submit" type="primary">
              确认驳回
            </Button>
          </Col>
        </Form>
      </Modal>
    </div>
  );
};

export default Rejection;
